<template>
	<view class="itemcard">
		<view class="u-flex u-flex-between title">
			<view class="l u-flex">
				<u--image width="30rpx" height="30rpx" :src="$z.imgsrc('imgs/t.png')"></u--image>
				<view style="width: 8rpx"></view>
				{{ item.deliveryEndTime ||''}}
			</view>
			<view class="r">
				<!-- {{item.logisticsState}} -->
				{{ zt}}
			</view>
		</view>
		<view class="f u-flex">
			<view class="l u-flex u-flex-center"> 发 </view>
			<view class="r" style="flex: 1;">
				<view class="t">
					{{ item.warehouseName }}
				</view>
				<!-- <view class="b">
					浙江省宁波市海曙区中山东路188号
				</view> -->
			</view>
			<!-- 	<view class="dhicon">
				<u--image width="36rpx" height="36rpx"
					:src="$z.imgsrc('cc27ba014c4c445bbda7bb4964d1dda6.png')"></u--image>
			</view> -->
		</view>
		<view class="s sgc u-flex" v-for="(orderitem,key) in deputyLogisticsOrder" :key="key">
			<view class="l u-flex u-flex-center"> {{key+1}} </view>
			<view class="r" style="flex: 1;">
				<view class="t">
					{{ orderitem.deliveryAddress }}
				</view>
				<view class="b" v-if="orderitem.contactsInfo.length==1">
					{{ orderitem.contactsInfo[0].name }}(订单号:{{orderitem.sourceOrder}})

					<!-- sourceOrder -->
				</view>
				<view class="b" v-if="orderitem.contactsInfo.length==1">
					{{ orderitem.contactsInfo[0].phone }}
				</view>
			</view>
			<view class="dhicon" v-if="orderitem.contactsInfo.length==1" @click="call(orderitem.contactsInfo[0].phone)">
				<u--image width="36rpx" height="36rpx"
					:src="$z.imgsrc('cc27ba014c4c445bbda7bb4964d1dda6.png')"></u--image>
			</view>
		</view>

		<view class="s u-flex">
			<view class="l u-flex u-flex-center"> 收 </view>
			<view class="r" style="flex: 1;">
				<view class="t">
					{{ item.deliveryAddress }}
				</view>
				<view class="b">
					{{ item.driverName }}(订单号:{{ item.sourceOrder }})
					<!-- 物流单item.id  -->
				</view>
				<view class="b">
					{{contactsInfo[0].phone}}
					<!-- {{ item.driverPhoneNumber }} -->
				</view>
			</view>
			<view class="dhicon" @click="call(contactsInfo[0].phone)">
				<u--image width="36rpx" height="36rpx"
					:src="$z.imgsrc('cc27ba014c4c445bbda7bb4964d1dda6.png')"></u--image>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		props: {
			item: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
		},
		data() {
			return {
				offset: [-3, -6],
				background: "#F2E7E0",
				value: 5,
				btnstyle: {
					height: "72rpx",
					fontSize: "26rpx",
					lineHeight: "30rpx",
				},
				status: "loadmore",
			};
		},
		computed: {
			zt() {

				return this.$z.baseobj.logisticsOrderStateOption[this.item.logisticsState]
			},
			contactsInfo() {
				return JSON.parse(this.item.contactsInfo) || [{}];
			},
			deputyLogisticsOrder() {
				if (!this.item.deputyLogisticsOrder) {
					return []
				}
				let r = JSON.parse(this.item.deputyLogisticsOrder) || [];



				r.forEach(e => {
					if (e.contactsInfo) {
						e.contactsInfo = JSON.parse(e.contactsInfo)
					}
				})
				console.log(r, "r,123");
				return r
			}
		},
		methods: {
			call(number) {
				if (!number) {
					this.$u.toast("未预留电话");
					return;
				}
				uni.makePhoneCall({
					phoneNumber: number, //仅为示例
				});
			},
			ontap() {
				uni.navigateTo({
					url: "/pagesall/orderxq/orderxq?id=" + this.item.id,
				});
			},
		},
	};
</script>

<style lang="scss">
	.itemcard {
		margin: 16rpx 18rpx;
		background-color: #fff;
		border-radius: 20rpx;
		position: relative;

		.yytime {
			background: #f5f5f5;
			margin: 0 24rpx;
			height: 80rpx;
			border-radius: 14rpx;
			padding-left: 58rpx;
			font-size: 26rpx;
			color: #181a1e;
		}

		.title {
			height: 80rpx;
			padding: 0 24rpx;
			font-size: 28rpx;
			border-bottom: 2rpx solid #e7e7ec;

			.l {
				font-size: 28rpx;
			}

			.r {
				// color: #DC2626;
				// font-weight: bold;
				// font-size: 42rpx;

				// .dw {
				// 	font-size: 26rpx;
				// 	padding-right: 10rpx;
				// }
			}
		}

		.s {
			align-items: flex-start;
			padding: 0 24rpx;
			padding-bottom: 28rpx;

			.l {
				width: 68rpx;
				height: 68rpx;
				border-radius: 28rpx;
				background: #dc2626;
				color: #fff;
				font-size: 36rpx;
				transform: scale(0.5);
				margin: -12rpx -17rpx;
				// margin-left: -17rpx;
			}

			.r {
				padding-left: 24rpx;
				color: #181a1e;
				font-size: 30rpx;
				line-height: 44rpx;
			}

			.b {
				color: #999999;
				font-size: 24rpx;
				margin-top: 14rpx;
				line-height: 32rpx;
			}
		}

		.sgc {
			position: relative;

			&::after {
				content: "";
				// width: 2rpx;
				border-left: 2rpx dashed #c0c0c0;
				// height: 10rpx;
				// background: #000;
				position: absolute;
				left: 40rpx;
				top: 46rpx;
				bottom: 0;
			}
		}

		.f {
			align-items: flex-start;
			padding: 0 24rpx;
			position: relative;
			padding-top: 28rpx;

			&::after {
				content: "";
				// width: 2rpx;
				border-left: 2rpx dashed #c0c0c0;
				// height: 10rpx;
				// background: #000;
				position: absolute;
				left: 40rpx;
				top: 46rpx;
				bottom: 0;
			}

			.l {
				width: 68rpx;
				height: 68rpx;
				border-radius: 28rpx;
				background: #181a1e;
				color: #fff;
				font-size: 36rpx;
				transform: scale(0.5);
				margin: -12rpx -17rpx;
				// margin-left: -17rpx;
			}

			.r {
				padding-left: 24rpx;
				padding-top: 10rpx;
				padding-bottom: 44rpx;

				.t {
					color: #181a1e;
					font-size: 30rpx;
					line-height: 32rpx;

					.jl {
						color: #999999;
						font-size: 24rpx;
						padding-left: 10rpx;
					}
				}

				.b {
					color: #999999;
					font-size: 24rpx;
					margin-top: 14rpx;
					line-height: 32rpx;
				}
			}
		}
	}

	.dhicon {
		width: 72rpx;
		height: 72rpx;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
		border: 2rpx solid #D0D3DA;
	}
</style>